/**
 * Author:yuiop
 * Date:2022/3/2 14:43
 */
package com.devops.constant;

public class DevOpsConstant {

    public static class RoleCode {
        public final static String SUPER_ADMINISTRATOR = "superAdministrator";
        public final static String ADMINISTRATOR = "administrator";
        public final static String TECHNOLOGY_MANAGER = "technologyManager";
        public final static String QA_ADMINISTRATOR = "qaAdministrator";
        public final static String WEB_MANAGER = "webManager";
        public final static String JAVA_ENGINEER = "javaEngineer";
        public final static String WEB_ENGINEER = "webEngineer";
        public final static String QA_ENGINEER = "qaEngineer";
        public final static String LOGIN_USER = "loginUser";
    }


    public static class ProjectGroupUserRelationUserType {
        public final static String PERSON_IN_CHARGE = "1";
        public final static String PERSON_MEMBER = "2";
    }

    public static class AliyunLogUrl {
        public final static String LOG_SEARCH_ALL = "https://sls4service.console.aliyun.com/lognext/project/<Project名称>/logsearch/<日志库名称>?hideTopbar=true&hideSidebar=true";
        public final static String LOG_SEARCH = "https://sls4service.console.aliyun.com/lognext/project/<Project名称>/logsearch/<日志库名称>?isShare=true&hideTopbar=true&hideSidebar=true";
        public final static String LOG_DASHBOARD = "https://sls4service.console.aliyun.com/lognext/project/<Project名称>/dashboard/<仪表盘ID>?isShare=true&hideTopbar=true&hideSidebar=true";
        public final static String SIGN_IN_DOMAIN = "https://signin.aliyun.com/federation";
        public final static String REDIRECT_URL = "https://juejin.cn/user/3702810893364350";
    }

    public static class ReleaseType {
        public final static Integer HELM = 1;
        public final static Integer YAML = 2;
    }

    public static class EnvType {
        public final static Integer UAT = 1;
        public final static Integer PRO = 2;
    }
    public static class ProjectVersionPhaseType {
        public final static Integer VERSION_CREATE = 1;
        public final static Integer UAT_TEST = 2;
        public final static Integer QA_REVIEW = 3;
        public final static Integer PRO_PUBLISH= 4;
        public final static Integer END = 5;
    }

    public static class ProjectVersionPhaseStatusType {
        public final static Integer VERSION_CREATE_SUCCESS = 1;
        public final static Integer UAT_TEST_ING = 2;
        public final static Integer UAT_TEST_FINISH = 3;
        public final static Integer QA_REVIEW_WAIT = 4;
        public final static Integer QA_REVIEW_ACCEPT = 5;
        public final static Integer QA_REVIEW_REJECT = 6;
        public final static Integer PRO_PUBLISH_WAIT = 7;
        public final static Integer PRO_PUBLISH_FINISH = 8;
        public final static Integer END_FOLLOW = 9;
    }

    public static class ProjectVersionOperateActionType {
        public final static Integer CREATE = 1;
        public final static Integer TEST_FINISH = 2;
        public final static Integer REVIEW_ACCEPT = 3;
        public final static Integer REVIEW_REJECT = 4;
        public final static Integer USER_CONFIRM = 5;
        public final static Integer PUBLISH_FINISH = 6;
        public final static Integer WEBHOOK_REVIEW_ACCEPT = 7;
        public final static Integer WEBHOOK_PUBLISH_FINISH = 8;
        public final static Integer WEBHOOK_REVIEW_REJECT = 9;
        public final static Integer SYSTEM_FINISH = 10;
    }

    public static class ProjectVersionOperateSourceType {
        public final static Integer WEB_TYPE = 1;
        public final static Integer DING_TYPE = 2;
        public final static Integer SYSTEM_TYPE = 3;
    }

    public static class ProjectVersionOperateLogType {
        public final static Integer ACTION_TYPE = 1;
        public final static Integer STATUS_TYPE = 2;
    }
    public static class PodConstant {
        public final static String RUNNING = "Running";
        public final static String TERMINATING = "Terminating";
        public final static String UNKNOWN = "Unknown";
        public final static String CONFIGMAP = "configMap";
        public final static String SECRET = "secret";
    }

    public static class SuffixType {
        public final static String TOTAL = "total";
        public final static String AVAILABLE = "available";
        public final static String UNAVAILABLE = "unavailable";
        public final static String READY = "ready";
        public final static String UPDATED = "updated";
    }

    public static class DeleteFlag {
        public final static String NOT_DELETE = "1";
        public final static String IS_DELETE = "2";
    }

    public static class MenuType {
        public final static Integer MODULE = 1;
        public final static Integer MENU = 2;
        public final static Integer BUTTON = 3;
    }

    public static class ChartType {
        public final static Integer PUBLIC = 1;
        public final static Integer PRIVATE = 2;
    }

    public static class HelmCheckType{
        public final static Integer CHECK_SUCCESS = 1;
        public final static Integer CHECK_FAILURE = 2;
        public final static Integer CHECKING = 3;
    }

    public static class CheckType{
        public final static Integer CHECK_SUCCESS = 1;
        public final static Integer CHECK_FAILURE = 2;
        public final static Integer CHECKING = 3;
    }

    public static class AuthorizeStatus{
        public final static Integer APPLY = 1;
        public final static Integer AGREE = 2;
        public final static Integer REFUSE = 3;
    }

    public static class UserType{
        public final static Integer CREATE = 1;
        public final static Integer MANAGER = 2;
        public final static Integer DEVELOPER = 3;
        public final static Integer QA = 4;
    }

    public static class ReleaseOperationFlag{
        public final static Integer INSTALL = 1;
        public final static Integer UPGRADE = 2;
        public final static Integer HISTORY = 3;
        public final static Integer ROLLBACK = 4;
        public final static Integer UNINSTALL = 5;
    }

    public static class K8sConfig {
        public final static String CONFIG_PATH_PREFIX = "/devops/k8s-config/";
        public final static String POD_LABEL_RELEASE_NAME = "app.kubernetes.io/instance";
        public final static String POD_LABEL_CHART_NAME = "app.kubernetes.io/name";
        public final static String K8S_LABEL_PROJECT_ID = "devops.project.id";
        public final static String K8S_LABEL_APPLY_TYPE = "devops.install.type";
        public final static String K8S_LABEL_DEPLOYED_TYPE = "deployed-by";
        public final static String K8S_LABELS = "labels";
        public final static String K8S_METADATA = "metadata";
        public final static String K8S_SELECTOR_MATCH_LABELS = "spec.selector.matchLabels";
        public final static String K8S_TEMPLATE_METADATA_LABELS = "spec.template.metadata.labels";
        public final static String POD_TEMPLATE_HASH = "pod-template-hash";
    }

    public static class HelmWrapperDomain {
        public static String LOCAL_HELM = "http://192.168.8.120:3001";
        public static String HUAWEIYUN_HELM = "https://helm-wrapper.uat.967111.net";
    }
    public static class HelmWrapperAPIUrl {
        //helm list -n
        public static String HELM_LIST_GET = "/api/namespaces/:namespaces/releases";
        //helm repo list
        public static String HELM_REPO_LIST_GET = "/api/repositories";
        //helm env
        public static String HELM_ENV_GET = "/api/envs";
        //helm search repo
        public static String HELM_SEARCH_REPO_GET = "/api/repositories/charts?keyword=:keyword";
        //helm search repo
        public static String HELM_SEARCH_REPO_VERSION_GET = "/api/repositories/charts?keyword=:keyword&version=:version";
        //获取上传的chart文件列表
        public static String HELM_CHART_UPLOAD_LIST_GET = "/api/charts/upload";
        //上传文件到服务器
        public static String HELM_UPLOAD_CHART_POST = "/api/charts/upload";
        //上传chart至远程仓库
        public static String HELM_UPLOAD_CHART_REPO_POST = "/api/repo/charts/upload";
        //helm repo update
        public static String HELM_REPO_UPDATE_PUT = "/api/repositories";
        //helm install param chart
        public static String HELM_INSTALL_POST = "/api/namespaces/:namespace/releases/:release?chart=:chart";
        //helm upgrade put
        public static String HELM_UPGRADE_PUT = "/api/namespaces/:namespace/releases/:release?chart=:chart";
        //helm history
        public static String HELM_HISTORY_GET = "/api/namespaces/:namespace/releases/:release/histories";
        //helm rollback
        public static String HELM_ROLLBACK_PUT = "/api/namespaces/:namespace/releases/:release/versions/:reversion";
        //helm uninstall
        public static String HELM_UNINSTALL_DELETE = "/api/namespaces/:namespace/releases/:release";
        //helm get values
        public static String HELM_VALUES_GET = "/api/namespaces/:namespace/releases/:release";

    }
    public static final String REDIS_KEY_DINGTALK_ACCESS_TOKEN = "DEV-OPS:DINGTALK:ACCESS_TOKEN";

    /**
     * 互动卡片接受类型
     * 0.用户 1.群组
     */
    public static class ConversationType {
        public static Integer USER = 0;
        public static Integer GROUP = 1;
    }

    public static class Status {
        public static Integer ACTIVE = 1;
    }

    public static final String PROJECT_VERSION_WORKFLOW_TASK_QUEUE = "project-version-workflow-task-queue";

    public static final String SYNC_KAFKA_TOPIC_WORKFLOW_TASK_QUEUE = "sync-kafka-topic-workflow-task-queue";

    public static final String API_USER_ID = "apiUserId";

    public static class RRECORD_STATUS {
        public static Integer OLD = 1;
        public static Integer NEW = 2;
    }
}
